package com.ll.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;

import com.ll.dao.UserCheckService;

public class UserCheckAction extends ActionSupport
{
	/**
	 * ajax检查数据库中所需信息是否重复
	 */
	public void checkCord()
	{
		String cord = this.getRequest().getParameter("username");

		try
		{
			boolean flag = UserCheckService.isExist(cord);
			if (flag)
			{
				this.getResponse().getWriter().write("true");
			}
			else
			{
				this.getResponse().getWriter().write("");
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	protected HttpServletRequest getRequest()
	{
		return ServletActionContext.getRequest();
	}

	protected HttpServletResponse getResponse()
	{
		return ServletActionContext.getResponse();
	}
}
